<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.ajax4jsf.org/rich">

<body>
<f:view>
    <ui:composition template="../../template/template.xhtml">

    <ui:define name="conteudo">
            
    <a4j:form id="formRecuperarPaciente" style="width: 50.1%; margin-left: 320px; border: 1px solid #B0C4DE; margin-top: -16px; margin-bottom: -16px;">
        
        <a4j:loadScript src="/js/jscripts.js"/>
		<a4j:loadScript src="/js/jquery.js"/>
        
        <rich:messages style="margin-left:10px; COLOR: #ff0000; FONT-WEIGHT: bold;"></rich:messages>
        
        <br />
        
       <center>
        	<b>Recuperar Paciente</b>
       </center> 
        
        <br />
        
        <div style="margin-left: 185px;">
        
            <h:panelGrid columns="2" style="margin-left:-167px;">
                <h:outputLabel value="Nome " style="FONT-WEIGHT: bold; margin-right: 13px; margin-left: 6px;"/>
                <h:inputText value="#{pacienteBean.paciente.noPaciente}" style="height : 23px; width : 536px;" maxlength="80" />
			</h:panelGrid>
            
           </div>
            
            <br />
            
           <center>
            
	            <a4j:commandButton id="botaoConsultar" action="#{pacienteBean.executarConsultar}" value="Consultar" reRender="tabelaRecuperaPaciente"/>
	            <a4j:commandButton id="botaoLimpar" action="#{pacienteBean.limparCampos}" value="Limpar" reRender="formRecuperarPaciente"/>
	            
           
            <br />
            <br />
            
            <rich:dataTable id="tabelaRecuperaPaciente" value="#{pacienteBean.pacientes}" var="pac" style=" width : 261px;">
            
                <rich:column style="text-align: center;">
                    <f:facet name="header">
                        <h:outputText value="Nome" />
                    </f:facet>
                    <h:outputText value="#{pac.noPaciente}" />
                </rich:column>
                
                <rich:column style="text-align: center;">
                    <f:facet name="header">
                        <h:outputText value="Data Nascimento"/>
                    </f:facet>
        				<h:outputText value="#{pac.dataFormatada}" />
                </rich:column>
                
                <rich:column style="text-align: center;">
                    <f:facet name="header">
                        <h:outputText id="cpf" value="CPF" >
                        <rich:jQuery selector="cpf" query="mask('999.999.999-99')" timing="onload"/>  
                        </h:outputText>
                    </f:facet>
                    <h:outputText value="#{pac.deCPF}" />
                </rich:column>
            
                <rich:column style="text-align: center;">
                	<f:facet name="header">
                		<h:outputText value="Selecionar"/>
                	</f:facet>
                	<a4j:commandLink action="#{marcarConsultaBean.pacienteRecuperado}" >
                		<h:graphicImage value="/imagens/seta_cima.png" title="Clique para selecionar o paciente" style="width : 30px; height : 29px;"/>
                		<f:setPropertyActionListener target="#{marcarConsultaBean.paciente}" value="#{pac}" />
                	</a4j:commandLink>
                </rich:column>
            </rich:dataTable>
    
            </center>
            
            <br />
            <br />
            <br />
            
            <a4j:keepAlive beanName="marcarConsultaBean"/>
            <a4j:keepAlive beanName="pacienteBean"/>
            
    </a4j:form>
</ui:define>
    </ui:composition>
</f:view>
</body>
</html>